include "nevo.n";

timinc = 5e-6;

node_soma = 0;
soma_dia = 20;
soma_rm  = get_freeparam("soma_rm");
soma_vrev = -0.07;
soma_vrest = -0.07;

vna = .035;
na6_dens = 10e-3;
na6_offm = .009;
na6_offh = .009;
na6_taua = 1;
na6_taub = 1;
na6_tauc = 30;
na6_taud = 1;

vk = -.100;
kdr_dens = 10e-3;
kdr_off = .024;
kdr_taun = 2.5;

if (notinit(curinj)) {
  fprintf(stderr, "Current injection amplitude not specified!\n");
  exit;
};
if (notinit(stimdur)) {
  fprintf(stderr, "Stimulus duration not specified!\n");
  exit;
};
if (notinit(starttime)) {
  fprintf(stderr, "Start time not specified!\n");
  exit;
};


at [node_soma] sphere
	 dia=soma_dia
	 rm=soma_rm
	 vrev=soma_vrev
	 vrest=soma_vrest;

at [node_soma] chan Na type 6
	density=na6_dens
	offsetm=na6_offm
	offseth=na6_offh
	taua=na6_taua
    taub=na6_taub
	tauc=na6_tauc
	taud=na6_taud
	ename na6_ename;

at [node_soma] chan K type 1
	density=kdr_dens
	offset=kdr_off
	taun=kdr_taun
	ename kdr_ename;

fprintf(stderr, "# Current to Inject: %g nA\n", curinj*1e9);
fprintf(stderr, "# Duration: %g ms\n", stimdur);
fprintf(stderr, "# Start Time: %g ms\n", starttime);

//plot V[node_soma] min -0.08 max 0.05 pen 4 plname "V[soma]" plnum 1;

endexp = (starttime + stimdur)*1e-3;

stim node [node_soma] cclamp=curinj start=starttime*1e-3 dur=stimdur*1e-3;
step endexp;
